---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  selector:
    matchLabels:
      name: postgres
  template:
    metadata:
      labels:
        name: postgres
    spec:
      containers:
      - name: postgres
        image: postgres
        imagePullPolicy: Always
        ports:
        - containerPort: 5432
        env:
        - name: POSTGRES_HOST_AUTH_METHOD
          value: trust
---
apiVersion: v1
kind: Service
metadata:
  name: postgres
  labels:
    name: postgres
  annotations:
    cloud.google.com/load-balancer-type: "internal"
spec:
  type: LoadBalancer
  ports:
  - protocol: "TCP"
    port: 5432
    targetPort: 5432
  selector:
    name: postgres
